package ar.com.age.distribuidora.presentacion.util;

import java.io.IOException;

import javax.faces.application.FacesMessage;
import javax.faces.context.ExternalContext;
import javax.faces.context.FacesContext;

import org.primefaces.context.RequestContext;

public class Redireccionador {

	
	public static void redireccionarA(String destino) {
		
		String url = destino;
		FacesContext fc = FacesContext.getCurrentInstance();
		ExternalContext ec = fc.getExternalContext();

		try {

			ec.redirect(url);

		} catch (IOException ex) {

			FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_ERROR, "Error", Mensajes.FALLA_SISTEMA);  
			RequestContext.getCurrentInstance().showMessageInDialog(message);
		}
	}
	
	
}
